<?php
// $Id: $

require('header.php');
require('utils.inc.php');

$modulelist = $template['modulelist'];
$usertype = $template['usertype'];
$usertype_level = $template['usertype_level'];
$usertype_id = $template['usertype_id'];
$usertypelevel_id = $template['usertypelevel_id'];
$moduletype = $template['moduletype'];

$id = '';
#echo '<pre>1: ',var_dump($moduletype),'</pre>';
#echo '<pre>2: ',var_dump($usermemberlist),'</pre>';
#echo '<pre>3: ',var_dump($superlist),'</pre>';
#echo '<pre>4: ',var_dump($supermemberlist),'</pre>';
?>
<br />
<form name="userright" method="post"> 
<table border="0" width="700" align="center">
    <tr bgcolor="#C7020D">
        <td colspan="100%" class="title">
            <a href="javascript:show_tool('filter');" class="mymenu">X</a> &nbsp;USER RIGHTS PROFILE:
        </td>
</table>

<table border="0" width="700" align="center">
    <tr bgcolor="#b3b3b3">
        <td align="center" colspan='3'>USER PRIVILEGE</td>
        <td align="center" colspan='3'>USER LEVEL</td>
        <td align="center" colspan='3'>SAVE / UPDATE</td>
    </tr>
    <tr bgcolor="#CCCCCC">
        <td align="center" colspan='3'>
            <?php show_select3('id','name','usertype_id', $usertype, $usertype_id);?>
        </td>
        <td align="center" colspan='3'>
            <?php show_select3('id','name','usertypelevel_id', $usertype_level, $usertypelevel_id, 'onchange="userright.submit()"');?>
        </td>
        <td align="center" colspan='3'>
			<input type="submit" name="save" value="Save">
        </td>
    </tr>
</table>
<br/>
<table border="0" width="700" align="center" id="table1">
<?
if (!empty($modulelist))
foreach ($moduletype as $detail){
		
?>
    <tr>
		<td align="center" class="field">&nbsp;</td>
    	<td align="center" class="field"><?=$detail['type']?></td>
	</tr>
<?php
	
	foreach ($modulelist as $id => $item) {
		if ($detail['type'] == $item['type']){
		$select = ($item['active'] == '1') ? 'checked' : '';
        $color = ($id/2 == round($id/2)) ? "#EFEFEF" : "#CCCCCC";
?>
	<tr bgcolor="<?=$color?>" 
        onclick="document.getElementById('ck_<?=$id?>').checked = (document.getElementById('ck_<?=$id?>').checked ? false : true)"
        onMouseOver="this.setAttribute('bgcolor','#FF9900')"
        onMouseOut="this.setAttribute('bgcolor','<?= $color?>')">
        <td align="center"><input type='checkbox' name='rights_id[]' id=ck_<?=$id?> value=<?=$item['user_right_id']?> <?= $select ?>> </td>
		<td ><?= $item['description'];?>&nbsp;</td>
	</tr>

<?	} //end if
}//end foreach
}//end foreach
?>

</table>
</form>
<?php
require('footer.php');
?>

